﻿// CDialogSktNearLmt.cpp: 实现文件
//

#include "stdafx.h"
#include "CDialogSktNearLmt.h"
#include "afxdialogex.h"
#include "SplitDemo.h"
#include "MainFrm.h"
// CDialogSktNearLmt 对话框

IMPLEMENT_DYNAMIC(CDialogSktNearLmt, CDialogEx)

CDialogSktNearLmt::CDialogSktNearLmt(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOGSKTNEARLIMIT, pParent)
{

}

CDialogSktNearLmt::~CDialogSktNearLmt()
{
}

void CDialogSktNearLmt::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT_MSG, m_EditMsg);
}


BEGIN_MESSAGE_MAP(CDialogSktNearLmt, CDialogEx)
	ON_BN_CLICKED(IDOK, &CDialogSktNearLmt::OnBnClickedOk)
	ON_WM_SIZE()
END_MESSAGE_MAP()


// CDialogSktNearLmt 消息处理程序


void CDialogSktNearLmt::OnBnClickedOk()
{
	//DestroyWindow();
	
	//CDialogEx::OnOK();
	ShowWindow(SW_HIDE);
}


void CDialogSktNearLmt::PostNcDestroy()
{
	

	CDialogEx::PostNcDestroy();
	delete this;
	g_pDlgSktNearLmt = NULL;
}


BOOL CDialogSktNearLmt::OnInitDialog()
{
	CDialogEx::OnInitDialog();
	//GetDlgItem(IDC_EDIT_MSG)->SetWindowTextW(m_strMsg);
	m_EditMsg.SetWindowTextW(m_strMsg);
	//CMainFrame* pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
	//SetParent(pMainFrame->pFormView2);
	return TRUE;  // return TRUE unless you set the focus to a control
				  // 异常: OCX 属性页应返回 FALSE
}


void CDialogSktNearLmt::OnSize(UINT nType, int cx, int cy)
{
	CDialogEx::OnSize(nType, cx, cy);
	//return;
	CRect rectview2, rectself,rectMsg;
	CMainFrame* pMainFrame = (CMainFrame*)AfxGetApp()->m_pMainWnd;
	pMainFrame->pFormView2->GetWindowRect(&rectview2);


	GetWindowRect(&rectself);
#if 1
	int nWidth= rectself.Width();
	int nHight= rectself.Height();
	rectself.left = rectview2.left+100;
	rectself.top = rectview2.top+100;
	rectself.right = rectself.left + nWidth;
	rectself.bottom = rectself.top + nHight;
	rectMsg = rectself;
	rectMsg.left = rectself.left + 30;
	rectMsg.right = rectself.right - 30;
	rectMsg.bottom = rectself.bottom - 100;
#endif
	
	ScreenToClient(&rectself);
	//m_EditMsg.MoveWindow(&rectself);
	if (rectview2)
	{
	//	m_EditMsg.SetWindowTextW(L"123");
	}
	

	
	//rectview2.left = 0;
	//rectview2.top = 0;
	//rectview2.right = 100;
	//rectview2.bottom = 100;
	
	MoveWindow(&rectself);
}
